﻿<script type="text/javascript">
    function toggle(source) {
      checkboxes = document.getElementsByName('color[]');
      for(var i=0, n=checkboxes.length;i<n;i++) {
            checkboxes[i].checked = source.checked;
      }
    }
</script>
<?php
	error_reporting(E_ALL ^ E_NOTICE);
	$id=$_REQUEST['id_product'];
	include "connection_open.php";
	$sql=mysql_query("select pc.*,c.* from product_color pc,color c where pc.id_color=c.id and id_product=$id order by nameVN ASC");
	$sql_size=mysql_query("select ps.*,s.* from product_size ps,size s where ps.id_size=s.id and id_product=$id");
	$query=mysql_query("select * from `product` where `id`=$id");
	if (!$query) 
	{
		die('Invalid query: ' . mysql_error());
	}
	while($row=mysql_fetch_array($query))
	{	
?>
	
	<form id="n" method="post" action="changeprice.php" name="n" >
		<table cellpadding="5px" align="center" width="100%">
			<input class="disa" type="hidden" name="product" readonly="true" disable="disable" value="<?=$id?>" />
			<th colspan=4 style="color:#09F;font-size:18px;"><a style="text-decoration:none;color:#09F" href="javascript:void(0);" onclick="window.open('http://stylehanq.com/shopping/?frame=product_detail&pid=<?=$row['id']?>')"><?=$row['name']?></a></th>
			<tr align="center">
			<td class="disable">Old Price:</td>
			<td><input id="price" class="disa" type="text" name="oldprice" readonly="true" value="<?=number_format($row['price'], 0, ',', ',') ?>" /></td>
			<td>New Price:</td>
			<td><input id="price" type="text" name="newprice" onkeyup="changePrice()" value="<?=number_format($row['price_new'], 0, ',', ',') ?>" /></td>
			</tr>
			<?php if(mysql_num_rows($sql)!=0){ ?>
			<tr>			
				<td colspan=4>					
					<div style="margin-bottom:10px;">Choose Color Wanna Be Deleted :</div>
						<?php
							$i=0;
							while($res=mysql_fetch_array($sql))
							{   							
						?>									
								<div style="display:inline-table;width:24%"><label><input class="color" name="color[]" type="checkbox" value="<?=$res['id_color'];?>" /><?=$res['nameVN'];?></label></div>
						<?php
									$i++;
									if($i%4==0){echo "<br>";}
							}
						?>		
						
				</td>
			</tr>
			<?php } ?>
			<tr>     
			</tr>
			<?php if(mysql_num_rows($sql_size)!=0){ ?>
			<tr>			
				<td colspan=4>					
					<div style="margin-bottom:10px;">Choose Size Wanna Be Deleted :</div>
						<?php
							$i=0;
							while($res_size=mysql_fetch_array($sql_size))
							{   							
						?>									
								<div style="display:inline-table;width:24%"><label><input class="size" name="size[]" type="checkbox" value="<?=$res_size['id_size'];?>" /><?=$res_size['size'];?></label></div>
						<?php
									$i++;
									if($i%4==0){echo "<br>";}
							}
						?>		
						
				</td>
			</tr>
			<?php } ?>
			<tr> 
            <td colspan=4><label><input class="outofstock" type="checkbox" name="outofstock" value="on" />Out Of Stock</label><!--<input type="checkbox" name="instock" value="" />&nbsp;Còn hàng--></td>          
            </tr>
			<tr>
			<th colspan=2>	
			<input id="change" class="change" type="button" name="change" value="Change" onclick="keep('<?=$row['id_shop']?>');check();" />
			</th>
			<th colspan=2>	
			<input id="cancel" class="change" type="button" name="cancel" value="Cancel" onclick="keep('<?=$row['id_shop']?>');huybo();" />
			</th>
			</tr>
			
		</table>
	</form>
	
<?php
	}
	include "connection_close.php";
?>	